<?php

	class xmlparser extends tecler {
		
		var $data = array();
		var $currentPage;
		var $currentContent;
		var $captureContent = false;
		
		function xmlparser(){
			$this->passParameterArray = false;
		}
		
		function _cdata( $code ){
			if( $this->captureContent ){
				$this->currentContent = $code;
			}
		}
		
		function _default( $name ){
			return "unknown '$name'";
		}

		function _getname( $string ){
			if( substr( $string, 0, 1 ) == '/' ){
				return substr( $string, 1 ) . '_end';
			} else {
				return $string;
			}
		}
		
		function page( $param ){
			$page = $this->parseParameters( $param );
			$this->currentPage = $page;
		}

		function page_end(){
			if( $this->currentPage['id'] ){
				$id = $this->currentPage['id'];
				unset( $this->currentPage['id'] );
				$this->data[$id] = $this->currentPage;
			}
			unset( $this->currentPage );
		}

		function content(){
			$this->currentContent = '';
			$this->captureContent = true;
		}

		function content_end(){
			$this->currentPage['content'] = $this->currentContent;
			$this->currentContent = '';
			$this->captureContent = false;
		}

	}

?>